package com.learnyou.server.xingzuo.controller.common;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;


@Api(tags = "XinzuoMediaResource")
@Validated
public interface XinzuoMediaResource {
    @ApiOperation("读取媒体资源")
    @GetMapping("/media/{target}")
    void getMedia(@PathVariable String target, HttpServletResponse response);

    @ApiOperation("上传媒体")
    @PostMapping("/media/{mediaSource}")
    String putMedia(@PathVariable String mediaSource, @RequestPart @RequestParam MultipartFile mediaFile);

    @ApiOperation("上传图片")
    @PostMapping("/image/{mediaSource}")
    String putImageMedia(@PathVariable String mediaSource, @RequestPart @RequestParam MultipartFile mediaFile);

    @ApiOperation("删除媒体")
    @DeleteMapping("/media/{target}")
    boolean removeMedia(@PathVariable String target);
}
